#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
bool capic(long int n);
int main()
{

int n1 = 100;
int n2 = 100;
long int sol = 0;
do{
    n1++;
    do{
        n2++;
        if (capic(n1 * n2)) if(n1 * n2 >sol) sol = n1*n2;

        }while (n2 <999);
        cout <<endl<< sol << "    " <<n1;
    n2 = 100;
}while (n1 < 999);
    return 0;
}

bool capic(long int n){
    int a,b,c,d,e,f;
    a = n % 10;
    b = (n / 10) % 10;
    c = (n / 100) % 10;
    d = (n / 1000) % 10;
    e = (n / 10000) % 10;
    f = (n / 100000) % 10;

    return (a + b*10 + c*100 + d*1000 + e*10000 + f*100000 == f + e*10 + d*100 + c*1000 + b*10000 + a*100000);
    }
